//--------------------------------------------------------CountryXY_corr.do
// CountryXY Correlation
// --------------------------------------------------------------------------
version 15 // ensure compatibility
clear all // start in a clean state
cls // clear the results window
set more off // show all output, dont wait if screen full
set seed 12345 // see note below
set rmsg on // displays how time to execute command s
cd "C:\Users\wachb\OneDrive - UvA\WInequality\Replicate_Analysis"
capture log close // closes any log file if currently open
log using CountryXY_corr, replace text

//open the data
use "C:\Users\wachb\OneDrive - UvA\WInequality\Replicate_Analysis\countryxyzcorr.dta"

//Appendix B1 and B2
asdoc pwcorr z_logRGTQ z_pimpl z_prepr z_prepr_wg z_GiniWealth z_MeanGiniSWIID z_meanUDS z_logMeanGDP if GTQmis == 5, obs star(all) save(B1_pwcorrGT.rtf) label
asdoc pwcorr z_logRGTQ z_pimpl z_prepr z_prepr_wg z_GiniWealth z_MeanGiniSWIID z_meanUDS z_logMeanGDP if preprimplmis == 6, obs star(all) save(B2_pwcorrPRIT.rtf) label

//pasted values in appendix B and manually changed the formatting (too many misc. changes to add here in asdoc)